package edu.tsinghua.ddb.dictionary;

import edu.tsinghua.ddb.util.Sql;


public class Column extends Identity {
	private static final long serialVersionUID = -6077111695630226622L;
	private int dataType;
	private boolean isPrimaryKey=false;

	/**
	 * @return the isPrimaryKey
	 */
	public boolean isPrimaryKey() {
		return isPrimaryKey;
	}

	/**
	 * @param isPrimaryKey the isPrimaryKey to set
	 */
	public void setPrimaryKey(boolean isPrimaryKey) {
		this.isPrimaryKey = isPrimaryKey;
	}

	public Column(String name, String dataType) {
		this.setName(name);
		this.setDataType(dataType);
	}

	public int getDataType() {
		return dataType;
	}

	public void setDataType(String dataType) {
		try {
			this.dataType =Sql.mapType(dataType);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();			
		}
	}

	public String getDataTypeString() {
		return Sql.mapType(this.dataType);
	}
}
